import request from '@/utils/request'

// 查询措施详细
export function getMeasure(id) {
  return request({
    url: '/fmea/common/measure/' + id,
    method: 'get'
  })
}

// 批量新增措施
export function addBatchMeasure(data) {
  return request({
    url: '/fmea/common/measure/batch',
    method: 'post',
    data: data
  })
}

// 修改措施
export function updateMeasure(data) {
  return request({
    url: '/fmea/common/measure',
    method: 'put',
    data: data
  })
}

// 排序
export function sortMeasure(params) {
  return request({
    url: `/fmea/common/structureTree/updateNodeOrder`,
    method: 'get',
    params: params
  })
}

// 检查措施是否唯一
export function checkMeasureUnique(params) {
  return request({
    url: '/fmea/common/measure/checkMeasureUnique',
    method: 'get',
    params: params
  })
}

// 获取优化对应的探测和预防
export function getOptMeasureList(params) {
  return request({
    url: '/fmea/common/measure/optimizationMeasureList',
    method: 'get',
    params: params
  })
}

// 删除措施节点
export function deleteMeasure(obj) {
  return request({
    url: '/fmea/common/measure/' + obj.id,
    method: 'delete',
    params: obj.data
  })
}
